class Api::V1::FeedbacksController < Api::V1::BaseController
  def create
    @feedback = Feedback.new feedback_params
    @feedback.user_id = @current_user.id
    if @feedback.save
      render json: { result: true, message: "反馈成功，稍后工作人员会联系您." }, status: :ok
    else
      render json: { result: false, message: render_errors(@feedback.errors.messages) }, status: :ok
    end
  end

  private

  def feedback_params
    params.require(:feedback).permit(:content)
  end
end
